/**
* @ProjectName: ShopSytem
* @Title: ViewInfo.java 
* @Package com.element5th.shop.servlet.user 
* @Description: 查看用户信息
* @author 第五元素小组   
* @date 2012-10-26 16:57:40 
* @version V1.0   
*/
package com.element5th.shop.servlet.user;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.element5th.shop.comm.DaoFactory;
import com.element5th.shop.dao.user.IUserDao;
import com.element5th.shop.dto.BaseDto;
import com.element5th.shop.entity.User;

/**
 * Servlet implementation class ViewUserInfo
 */
@WebServlet({"/view_user", "/admin/view_user"})
public class ViewInfo extends HttpServlet {
	private static final long serialVersionUID = 1L;
       

	/**
	 * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		HttpSession session = request.getSession();
		String userName =(String) session.getAttribute("userName");
		BaseDto dto =new BaseDto();
		dto.setUser(new User(null,userName,null));
		dto = DaoFactory.getUserDao().viewUserInfo(dto);
		session.setAttribute("userInfo", dto.getUser());
		request.getRequestDispatcher("/page/user/userinfo.jsp").forward(request,response);
	}

}
